//
//  MyView.m
//  sheep-must-die
//
//  Created by eewert on 11/30/11.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import "MyView.h"


@implementation MyView

@synthesize touchStart;
@synthesize touchEnd;
@synthesize shouldDrawLine;

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        // Initialization code
        shouldDrawLine = NO;
    }
    return self;
}


// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect
{
    [super drawRect:rect];
    // Drawing code
    if(shouldDrawLine)
    {
        CGContextRef ctx = UIGraphicsGetCurrentContext();
        CGContextSetRGBStrokeColor(ctx, 1.0, 0, 0, 1);
        CGContextSetLineWidth(ctx, 2);
        CGContextMoveToPoint(ctx, touchStart.x, touchStart.y);
        CGContextAddLineToPoint( ctx, touchEnd.x, touchEnd.y);
        CGContextStrokePath(ctx);
    }
}


- (void)dealloc
{
    [super dealloc];
}

@end
